<?php
/**
 * 自动清理天气更新历史表，并修复和优化所有系统表，每30分钟执行一次。
 */

chdir("/data/www/w.mdeve.com/htdocs/");
require 'runtime.php';

$db = init_db();

$row = $db->get_row("select count(*) as num from weather_history");
if($row['num'] > 500) $db->query("TRUNCATE TABLE `weather_history`");
//$db->query("REPAIR TABLE  `parameter` ,  `weather_alarm` ,  `weather_count` ,  `weather_data` ,  `weather_history` , `weather_server`");
//$db->query("OPTIMIZE TABLE `parameter` ,  `weather_alarm` ,  `weather_count` ,  `weather_data` ,  `weather_history` , `weather_server`");
$db = null;
echo "done";
?>
